Skip to content
created by Aha00aAha00a at 2020-08-16
last modified by Aha00aAha00a at 2020-08-17
revision: 6

How To Configure Babel Transpiling in IntelliJ IDEA with non Node.js Project

How To

Node.js가 아닌 프로젝트에서 IntelliJ IDEA의 File Watcher를 이용해서 Babel Transpiling을 하는 방법

원래 목적은 특정 폴더 하위의 .js 파일만을 외부에 transpile 하고 싶었던건데 결국 그렇게는 안되고, 결국 찾아낸 방법은 .es6파일을 .es6.js로 하는 것.

어쩔 수 없이 Node.js가 필요하긴 하다.

일단 --save-devBabel 설치.

npm install --save-dev @babel/core @babel/cli @babel/preset-env @babel/polyfill

설정창을 열고 다음과 같이 설정한다.

  • Preferences
    • Tools
      • File Watchers
        • [+]
          • Babel
            • File type: ECMAScript 6
            • Arguments:
              $FilePathRelativeToProjectRoot$ --out-file $FilePathRelativeToProjectRoot$.js --source-maps --presets @babel/env
            • Output paths to refresh:
              $FilePathRelativeToProjectRoot$.js:$FilePathRelativeToProjectRoot$.js.map
            • [OK]
    • [OK]

File type을 ECMAScript 6로 하는 이유는 .js는 그대로 두고, .es6.es6.js.es6.js.map으로 transpile하기 위함이다.

그래서 sample.es6파일을 추가하여 편집하면 File Watcher가 동작하여 sample.es6.jssample.es6.js.map 파일이 생성되게 된다.

--2020-08-16

1. See Also

1.2. Similar Pages

Similar pages by cosine similarity. Words after page name are term frequency.

  • 32.67% webpack js(7:9), babel(9:5), node(3:2), env(2:2), dev(1:2), core(1:2), preset(1:2), aha00a(1:1), source(1:1), with(1:1)

1.3. Adjacent Pages

Control
≤ 32
all
1.0x
1.0x
80
-120
ON
Metrics
Nodes(visible/total)0/0
Links(visible/total)0/0
Avg degree0.00
Depth coverage0
Queue(fetch/graph)0 / 0
Zoom(scale)1.00x
Ctrl/⌘ + Scroll: Zoom
Root 1-hop 2-hop+